import sys

def parse_key_value_file(filepath):
    """解析key,value格式的文件"""
    with open(filepath, 'r', encoding='utf-8') as f:
        return dict(line.strip().split(',', 1) for line in f if line.strip())

def compare_files(file1_path, file2_path):
    """比较两个文件并统计结果"""
    file1_data = parse_key_value_file(file1_path)
    file2_data = parse_key_value_file(file2_path)
    
    same = diff = 0
    for key in file1_data:
        if key in file2_data:
            if file1_data[key] == file2_data[key]:
                same += 1
            else:
                diff += 1
    
    print(f"value相同的key数: {same}")
    print(f"value不同的key数: {diff}")
    print(f"总和: {same + diff}")

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("用法: python script.py <文件1路径> <文件2路径>")
        sys.exit(1)
    
    compare_files(sys.argv[1], sys.argv[2])